//
//  NetWorkRequest.h
//  网络封装
//
//  Created by 潮汐 on 15-1-8.
//  Copyright (c) 2015年 chaox. All rights reserved.
//

#import <Foundation/Foundation.h>

@class NetWorkRequest;

@protocol NetWorkRequestDelegate <NSObject>
@optional
//network请求成功
- (void)netWorkRequest:(NetWorkRequest *)request SuccessfulReceiveData:(NSData *)data;

//network请求失败
- (void)netWorkRequest:(NetWorkRequest *)request didFailed:(NSError *)error;

//获取network下载进度
- (void)netWorkRequest:(NetWorkRequest *)request withProgress:(NSInteger)progress;


@end



@interface NetWorkRequest : NSObject<NSURLConnectionDataDelegate>

@property (nonatomic,assign) id<NetWorkRequestDelegate> delegate;

//声明两个方法,对外提供接口,分别实现GET请求方式和POST请求方式
//实现GET请求
- (void)requestForGETWithUrl:(NSString *)urlString;

//实现POST请求
- (void)requestForPOSTWithUrl:(NSString *)urlString postData:(NSData *)postData;

//取消网络请求
- (void)cancelRequest;

@end
